

public class FetchCommand extends ICommand {

	private String serviceName;
	
	public FetchCommand(byte seqNumber, int type) {
		super(seqNumber, type);
		this.serviceName = "";
	}

	@Override
	public byte[] generateMessage() {		
		byte[] serviceNameTemp = serviceName.getBytes();
		byte[] ret = Util.generateHeader(seqNumber, type, 5 + serviceNameTemp.length);
		
		ret[4] = (byte) (serviceNameTemp.length & 0xFF);
		
		for (int i = 0; i < serviceNameTemp.length; i ++) {
			ret[5 + i] = serviceNameTemp[i];
		}
		
		return ret;
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}
	
	public String getServiceName() {
		return this.serviceName;
	}
	
	
}
